#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std; 
typedef long long ll; 

#define N 21
#define BN (20*5000000/32 + 1)

vector<ll> all_sum; 
vector<ll> deduped_sum; 

unsigned bitmap[BN]; 


ll max_sum; 
int a[N]; 
int n, k; 

int visited[N]; 

void dfs(int l, int s, ll sum)
{
	if (l==k) {
		max_sum = max(max_sum, sum); 
		all_sum.push_back(sum); 
		return; 
	}
	for (int i=s; i<n; i++) {
		if (visited[i])
			continue; 
		visited[i] = 1; 
		dfs(l+1, i, sum+a[i]); 
		visited[i] = 0; 
	}
}

int count(void)
{
	int ret = 0;
	ll sqrt_max_sum = (ll)sqrt(max_sum) + 1; 
	for (ll i=2; i<=sqrt_max_sum; i++) {
		ll a=i/32, b=a%32; 
		if ((bitmap[a]&(1<<b))!=0) {
			continue; 
		}
		for (ll j=2*i; j<=max_sum; j+=i) {
			ll a=j/32, b=j%32; 
			bitmap[a] |= (1<<b); 
		}
	}
	sort(all_sum.begin(), all_sum.end()); 
	ll last=-1; 
	for (unsigned i=0; i<all_sum.size(); i++) {
		if (all_sum[i]==last)
			continue; 
		deduped_sum.push_back(all_sum[i]); 
		last = all_sum[i]; 
	}

	for (unsigned i=0; i<all_sum.size(); i++) {
		ll j = all_sum[i]; 
		ll a=j/32, b=j%32; 
		if ((bitmap[a] & (1<<b))==0) {
			ret ++; 
		}
	}
	return ret; 
}

int main()
{
	int res; 
	
	//freopen("p1036_1.in", "r", stdin); 
	
	cin>>n>>k; 
	for (int i=0; i<n; i++) {
		cin>>a[i]; 
	}
	dfs(0, 0, 0); 
	
	res = count(); 
	cout<<res; 
	
	return 0; 
}


